package practice_03;

import java.util.Scanner;

//旋转字符串
//输入:字符串 A，字符串 B
//要求:旋转字符串A，直到出现与B一样的字符串，返回true，否则false
//输出;true /false
public class Rotate {

    public static void rotate() {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入字符串A:");
        String A = sc.nextLine();
        System.out.print("请输入字符串B:");
        String B = sc.nextLine();
        boolean flag = false;
        for (int i = 0; i < A.length(); i++) {
            A = A.substring(1) + A.substring(0, 1);
            if (A.equals(B)) {
                flag = true;
                break;
            }
        }
        System.out.println(flag);
        ;
    }
}
